package com.chen.wow.day04.mvc;

import org.junit.Test;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import com.chen.wow.day04.mvc.controller.HelloController;

public class TestController {

	public void play() throws Exception{
		HelloController controller = new HelloController();
		MockMvc mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
		mockMvc.perform(MockMvcRequestBuilders.get("/"));
	}
	
	@Test
	public void query() throws Exception{
		HelloController controller = new HelloController();
		MockMvc mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
		mockMvc.perform(MockMvcRequestBuilders.get("/query?name=你abc"))
			.andExpect(MockMvcResultMatchers.view().name("query"));
	}
}
